 Array.prototype.remove=function(dx) 
{ 
    if(isNaN(dx)||dx>this.length){return false;} 
    for(var i=0,n=0;i<this.length;i++) 
    { 
        if(this[i]!=this[dx]) 
        { 
            this[n++]=this[i] 
        } 
    } 
    this.length-=1 
}
Array.prototype.in_array = function(a,b)
{
	for(i=0;i<this.length;i++)
	{
		
		if(arguments.length==1&&this[i]==a)
		{
			return true;
		}
		else if(arguments.length==2&&this[i][a]==b)
		{
			return true;
		}
	}
	return false;
}

/*
用户注册时（数据库插入新用户）,
建立如下触发器
1,添加一条用户主题设置表记录
2,添加新闻，优惠，好友推荐，好友动态的用户群发信息读取记录表各一条

用户加入群组或讨论组时
建议触发器
1，在该群/讨论组中插入一条添加了你的信息
2，在用户群发信息读取表(msgindex)插入一条记录 readid初始就是该群/讨论组max(id)的一条信息
*/














/*
	当前界面所属用户对象 （2015/7/13废弃，用toper对象替代）

var current=
{
	id:0,//每一个界面点击时，更新这个id号，便于程序查看点击的事件所属的用户id
	fid:0,//好友id，每当聊天框被点击时，更新这个id号，发送消息时与id配合使用
	frame:null,//当前被点击的对话框
}
*/


/*
	界面点击置顶控制
	window被点击后检查被点击的元素，根据元素的z-index情况 加200 并保存这个置顶框架的id，
	另一个界面被点击后则将此前保存过的指定的框架减200，再将当前点击的框架加200处理
*/

function Toper()
{
	//之前点击的框架
	var prev=null;
	//当前点击的框架
	var now=null;

	//当前的界面所属用户id
	var uid=0;
	//当前界面的好友id全名
	var frdid=null;

	//当前界面的好友id
	var fonlyid=0;

	//当前界面类型
	var frdtype=null;

	//框架z-inde仓库
	var zbank=[
	[
		['loginbox',100],['.logincnt',103],['#selectacc',102],['.qrloginpanel',105],['#statuslist',10000000]
	],	
	[
		['mainboard',50],['.mainboardcolor',51],['.mainboardglass',52],['.mainboardcontent',53],['.mainboardcontent .mainsearchbar>.masbar',54],['.mainboardcontent .frdpage',54],['.mainboardcontent .frdpage>.icopage',56],['.mainboardcontent .frdpage>.icopagebg',53],['.mainboardcontent .frdpage>.icopagecolor',52]
	],	
	[
		['chatframe',30],['.chatcolor',31],['.chatbg',32],['.chatboard',34],['.chatboard span',40],['.chatboard>.chatcontent>.chatrighthide',39],['.chatboard>.chatcontent>.chatrightshow',39]
	],	
	/*
	[
		['loginbox',],[],[],[],[],[],
	]
	*/
	];

	this.set=function(frameid)
	{
		prev=now;
		now=frameid;
		if(prev==now)
		{
			return false;
		}
		for(var i=0;i<zbank.length;i++)
		{
			if(now.indexOf(zbank[i][0][0])>=0)
			{
				//内部提取id
				if(zbank[i][0][0]=="chatframe")
				{
					var reg=/chatframe_([a-zA-z]+)(\d+)_(\d+)/;
					var cid=reg.exec(now);//cid[0]=chatframe_x_y cid[1]=x cid[2]=y
					//console.log(cid);
					//更新当前用户id和好友id
					uid=parseInt(cid[3]);
					frdid=cid[1]+cid[2];
					frdtype=cid[1];
					fonlyid=cid[2];
				}
				else
				{
					uid=parseInt(now.replace(zbank[i][0][0]+"_",""));
				}

				//console.log("zb="+zbank[i][0][0]+"_"+"  uid="+uid+",fid="+frdid);

				//设置z-index
				$("#"+now).css("z-index",zbank[i][0][1]+200);
				for(var j=1;j<zbank[i].length;j++)
				{
					$("#"+now).find(zbank[i][j][0]).css("z-index",zbank[i][j][1]+200);
				}
			}
		}

		if(prev!=null)
		{
			for(var i=0;i<zbank.length;i++)
			{
				if(prev.indexOf(zbank[i][0][0])>=0)
				{
					$("#"+prev).css("z-index",parseInt(zbank[i][0][1])-200);
					for(var j=1;j<zbank[i].length;j++)
					{
						$("#"+prev).find(zbank[i][j][0]).css("z-index",parseInt(zbank[i][j][1])-200);
					}
				}
			}
		}

	}


	//获取当前id
	this.who=function()
	{
		return now;
	}
	//获取当前用户id
	this.id=function()
	{
		return uid;
	}
	//获取当前好友id
	this.fid=function()
	{
		return frdid;
	}
	this.foid=function()
	{
		return fonlyid;
	}
	this.ftype=function()
	{
		return frdtype;
	}
	//设置当前用户id
	this.setid=function(id)
	{
		uid=id;
	}
	//设置当前好友id
	this.setfid=function(fid)
	{
		frdid=fid;
	}
}


var toper=new Toper();


	
/*
用户信息存储对象
User.info	用于存储用户信息的数组
add			添加一个用户信息到info中
set			根据提供的属性和值修改info
setbyid		通过id修改添加数组
setbyacc	通过账号修改添加数组
setbyindex	通过数组下标修改添加数组
getbyid		通过用户id搜用户信息
getbyindex	通过数组下标搜用户信息
getbyacc	通过用户账户搜用户信息
getallid	获取所有用户id
getindex	通过用户id搜索数组下标
getid		通过数组下标搜用户id
getacc		通过用户id搜用户账号
getinfo		查看所有用户数组
removeid	通过用户id移除该用户数组
removeindex 通过数组下标移除该用户数组
removeacc	通过账户移除该用户数组

 function User()
{
	var info=null;
	this.add=function(obj)
	{
		if(obj!=null||obj!=undefined)
		{
			if(info==null)
			{
				info=new Array();
			}
			info.push(obj);
		}
	}
	
	this.set=function(type,typevalue,attr,value)
	{
		var index=null;
		if(info!=null&&info.length>0)
		{
			if(type=="index")
			{
				tv=parseInt(typevalue);
				if(info[index]!=undefined&&info[index].length>0)
				{
					index=tv;
				}
			}
			else
			{
				for(var i in info)
				{
					if(type=="acc")
					{
						if(info[i].account==typevalue)
						{
							id=i;
						}
					}else if(type=="id")
					{
						if(info[i].id==parseInt(typevalue))
						{
							id=i;
						}
					}
				}
			}

			if(id!=null)
			{
				if(attr=="theme")
				{
					info[id].theme=value;
				}
			}
		}
	}

	this.setbyid=function(uid,arr)
	{
		if(info!=null&&info.length>0)
		{
			for(var i in info)
			{
				if(info[i].id==parseInt(uid))
				{
					info[i]=arr;
					return true;
				}
			}
			return false;
		}
		else
		{
			return false;
		}
	}

	this.setbyacc=function(acc,arr)
	{
		if(info!=null&&info.length>0)
		{
			for(var i in info)
			{
				if(info[i].account==acc)
				{
					info[i]=arr;
					return true;
				}
			}
			return false;
		}
		else
		{
			return false;
		}
	}
	this.setbyindex=function(index,arr)
	{
		if(info!=null&&info.length>0)
		{
			if(info[index]!=undefined&&info[index].length>0)
			{
				info[index]=arr;
				return true;
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}

	this.getbyid=function(usrid)
	{
		if(info!=null&&info.length>0)
		{
			for(var i in info)
			{
				if(info[i].id==parseInt(usrid))
				{
					return info[i];
				}
			}
			return false;
		}
		else
		{
			return false;
		}	
	}

	this.getbyindex=function(index)
	{
		if(info!=null&&info.length>0)
		{
			if(info[index]!=undefined&&info[index].length>0)
			{
				return info[index];
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}
	this.getbyacc=function(acc)
	{
		if(info!=null&&info.length>0)
		{
			for(var i in info)
			{
				if(info[i].account==acc)
				{
					return info[i];
				}
			}
			return false;
		}
		else
		{
			return false;
		}	
	}

	this.getallid=function()
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		var a=[];
		for(var i=0;i<info.length;i++)
		{
			a.push(info[i].id);
		}
		return a;
	}

	
	this.getindex=function(usrid)
	{
		if(info!=null&&info.length>0)
		{
			for(var i in info)
			{
				if(info[i].id==usrid)
				{
					return i;
				}
			}
			return false;
		}
		else
		{
			return false;
		}
	}

	this.getid=function(index)
	{
		if(info!=null&&info.length>0)
		{
			if(info[index]!=undefined&&info[index].length>0)
			{
				return info[index].id;
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}
	this.getacc=function(usrid)
	{
		if(info!=null&&info.length>0)
		{
			for(var i in info)
			{
				if(info[i].id==parseInt(usrid))
				{
					return info[i].account;
				}
			}
			return false;
		}
		else
		{
			return false;
		}
	}

	this.getinfo=function()
	{
		return info;
	}

	this.removeid=function(usrid)
	{
		if(info!=null&&info.length>0)
		{
			for(var i in info)
			{
				if(info[i].id==parseInt(usrid))
				{
					info.remove(i);
					return true;
				}
			}
			return false;
		}
		else
		{
			return false;
		}
	}
	this.removeacc=function(acc)
	{
		if(info!=null&&info.length>0)
		{
			for(var i in info)
			{
				if(info[i].account==acc)
				{
					info.remove(i);
					return true;
				}
			}
			return false;
		}
		else
		{
			return false;
		}
	}


	this.removeindex=function(index)
	{
		if(info!=null&&info.length>0)
		{
			if(info[index]!=undefined&&info[index].length>0)
			{
				info.remove(index);
				return true;
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}

}



/*
	用户好友对象
	用户登陆后，将其所有好友的id保存到此对象中

Friend.f 用户好友存储数组
set(fid,uid) 添加用户好友到数组对象中 fid可以是单id和id数组
getbyid(uid) 通过用户id获取其所有好友
isfrd(fid,uid) 用户是否有这个朋友
getall()		获取整个存储数组
removefrd(fid,uid)	删除用户的某一个好友
removeid(uid)		移除该用户所有好友信息
getbyfid(fid,uid)	获取好友的一条信息
getfid(fid,uid)		获取好友的真实id
getgid(fid,uid)		获取好友所在的分组id



function Friend()
{
	var f=null;

	this.set=function(fid,uid)
	{
		var k=new Array();
		if(f==null||f.length<=0)
		{
			f=new Array();

			k.push(uid);
			if(fid instanceof Array)
			{
				k.push(fid);
			}else
			{
				var f_arr=new Array();
				f_arr.push(fid);
				k.push(f_arr);
			}
			f.push(k);
			return true;
		}
		else
		{
			for(var i=0;i<f.length;i++)
			{
				if(f[i][0]==uid)
				{
					if(fid instanceof Array)
					{
						f[i][1]=f[i][1].concat(fid);
					}
					else
					{
						f[i][1].push(fid);
					}
					return true;
				}
			}
			k.push(uid);
			if(fid instanceof Array)
			{
				k.push(fid);
			}else
			{
				var f_arr=new Array();
				f_arr.push(fid);
				k.push(f_arr);
			}
			f.push(k);
			return true;
		}
		
	}

	this.getbyid=function(uid)
	{
		if(f==null||f.length<=0)
		{
			return false;
		}
		for(var i=0;i<f.length;i++)
		{
			if(f[i][0]==uid)
			{
				return f[i][1];
			}
		}
		return false;
	}

	this.isfrd=function(fid,uid)
	{
		if(f==null||f.length<=0)
		{
			return false;
		}
		for(var i=0;i<f.length;i++)
		{
			if(f[i][0]==uid)
			{
				if(f[i][1]==null||f[i][1]==undefined||f[i][1].length<=0)
				{
					return false;
				}
				for(var j=0;j<f[i][1].length;j++)
				{
					if(f[i][1][j]==fid)
					{
						return true;
					}
				}
				return false;
			}
		}
		return false;
	}

	this.getall=function()
	{
		return f;
	}


	this.removefrd=function(fid,uid)
	{
		if(f==null||f.length<=0)
		{
			return false;
		}
		for(var i=0;i<f.length;i++)
		{
			if(f[i][0]==uid)
			{
				for(var j=0;j<f[i][1].length;j++)
				{
					if(f[i][1][j]==fid)
					{
						f[i][1].remove(j);
						return true;
					}
				}
				return false;
			}
		}
		return false;
	}


	this.removeid=function(uid)
	{
		if(f==null||f.length<=0)
		{
			return false;
		}
		for(var i=0;i<f.length;i++)
		{
			if(f[i][0]==uid)
			{
				f.remove(i);
				return true;
			}
		}
		return false;
	}

	this.getbyfid=function(fid,uid)
	{	
		if(f==null||f.length<=0)
		{
			return false;
		}
		for(var i=0;i<f.length;i++)
		{
			if(f[i][0]==uid)
			{
				for(var j=0;j<f[i][1].length;j++)
				{
					if(f[i][1][j].frdid==fid)
					{
						return f[i][1][j];
					}
				}
				return false;
			}
			//return false;
		}
		return false;
	}	
	this.getfid=function(fid,uid)
	{	
		if(f==null||f.length<=0)
		{
			return false;
		}
		for(var i=0;i<f.length;i++)
		{
			if(f[i][0]==uid)
			{
				for(var j=0;j<f[i][1].length;j++)
				{
					if(f[i][1][j].id==fid)
					{
						return f[i][1][j].frdid;
					}
				}
				return false;
			}
			return false;
		}
		return false;
	}	
	this.getgid=function(fid,uid)
	{	
		if(f==null||f.length<=0)
		{
			return false;
		}
		for(var i=0;i<f.length;i++)
		{
			if(f[i][0]==uid)
			{
				for(var j=0;j<f[i][1].length;j++)
				{
					if(f[i][1][j].id==fid)
					{
						return f[i][1][j].gid;
					}
				}
				return false;
			}
			return false;
		}
		return false;
	}	
}
*/


function imgloaded(img, callback) {
	var timer = setInterval(function() {
		if (img.complete) {
			callback(img);
			clearInterval(timer);
		}
	}, 50);
}





/*
框架拖动方法

drag(target,movetarget,position,callback)

点击的目标,需要移动的目标（如空则点击移动为同一目标）,移动方向及范围限制,回调函数

移动方向及范围限制（对象类型，默认空,position.x=true则只平移,position.y=true则只上下移动,position.maxY=XX最大高度，position.maxX=XX最大宽度,postion.maxtop最大上方位，postion.maxleft,最大左方位，position.mintop最小上方位，position.minleft最小左方位）





2016/1/23新增方案:
--------------------------------------------------------------
position.n=true 向上拉伸;
position.s=true 向下拉伸;
position.w=true 向左拉伸
position.e=true 向右拉伸
position.nw=true 向左上拉伸
position.ne=true 向右上拉伸
position.sw=true 向左下拉伸
position.se=true 向右下拉伸
position.stretchscale=true/false 按照比例拉伸true，默认false
position.overflow=true/false 拉伸可以超出范围true 默认false
---------------------2016/1/24否决以上--------------------------------------

-----下面对象都必须是absolute---------------

position.maxleftobj 用于计算最大左距离的对象
position.minleftoffset  最小左距离的预留值(left+)
position.maxleftoffset  最大左距离的预留值(left-)

position.maxtopobj 用于计算最大上距离的对象
position.mintopoffset  最小上距离的预留值 (top+)
position.maxtopoffset  最大上距离的预留值 (top-)
--------------------------------------------

position.right=true 右边作为基点
position.bottom=true 底部作为基点
-----------------2016/1/27否定以上全部，保留下面5个参数---------------------------

position.rangeparent 父对象，直接使用父对象的话，可以根据父对象判断出移动物的移动范围(使用此作为范围，可以避免因预设范围固定而对后面的程序产生影响)

position.upcallback 当鼠标提起时回调函数
position.downcallback 当鼠标按下时回调函数

position.presetcall 对拖动生成的位移（top,left）进行过滤处理
position.posdiy		不使用拖动方法内部对位移的范围处理，自行处理(通常与上面的方法配合使用)


如果要控制范围，可以在回调函数中自定义
*/

function drag(target,movetarget,position,callback)
{
	var px=0;
	var py=0;
	var ptop=0;
	var pleft=0;
	var flag=false;
	
	var width=0;
	var height=0;

	var winX=0;
	var winY=0;

	var maxX=0;
	var maxY=0;
	var minX=0;
	var minY=0;
	
	var setmove=true;
	
	var id=null;
	var obj=null;
	var position=position;
	var callback=callback;
	//console.log('position=');
	//console.log(position);
	

	target.mousedown(function(e)
	{
		upflag=false;
		if(position!=undefined&&position!=null&&typeof position.downcallback=='function')
		{
			//var o={id:id,obj:obj,left:l,top:t};
			position.downcallback();
		}

		if(movetarget==undefined||movetarget==null||movetarget=='')
		{
			if($(this).attr('id'))
			{
				id=$("#"+$(this).attr("id"));
				toper.set($(this).attr("id"));
			}
			else
			{
				id=target;
			}
		}
		else
		{
			if(movetarget.attr('id'))
			{
				id=$("#"+movetarget.attr("id"));
				toper.set(movetarget.attr("id"));
			}
			else
			{
				id=movetarget;
			}
		}
		obj=e.target;
		/*if(candrag!=undefined||id.attr(candrag)!=undefined&&id.attr(candrag)=="false")
		{
			flag=false;
			return false;
		}*/

		ptop=id.css("top").replace('px',"");
		pleft=id.css('left').replace('px',"");

		width=id[0].clientWidth;
		height=id[0].clientHeight;
		
		if(position)
		{
			if(position.rangeparent!=undefined)
			{
				maxY=position.rangeparent[0].offsetHeight-id[0].offsetHeight;
				maxX=position.rangeparent[0].offsetWidth-id[0].offsetWidth;
			}
			else if(position.maxX!=undefined)
			{
				maxX=position.maxX;
				maxY=position.maxY;
			}
			else
			{
				winX=window.innerWidth||document.body.clientWidth;
				winY=window.innerHeight||document.body.clientHeight;

				maxX=winX-width;
				maxY=winY-height;
			}
			position.minX!=undefined?minX=position.minX:'';
			position.minY!=undefined?minY=position.minY:'';
		}
		else
		{

			winX=window.innerWidth||document.body.clientWidth;
			winY=window.innerHeight||document.body.clientHeight;

			maxX=winX-width;
			maxY=winY-height;
		}

		

		flag=true;
		px=e.pageX;
		py=e.pageY;
		//console.log("px="+px+",py="+py);
		e.stopImmediatePropagation();
	});
	//鼠标弹起是全局操作，因此回调函数必须仔细对比操作所响应的元素，避免污染全局
	$(document).mouseup(function(e)
	{
		flag=false;
		//console.log(position);
		if(position!=undefined&&position!=null&&typeof position.upcallback=='function')
		{
			//var o={id:id,obj:obj,left:l,top:t};
			position.upcallback(e);
		}
		
		//return;
		//ptop=id.css("top").replace('px',"");
		//pleft=id.css('left').replace('px',"");
		//e.stopImmediatePropagation();
	});
	$(document).mousemove(function(e)
	{
		if(id==null)
		{
			flag=false;
		}
		if(flag)
		{
			var nowX=e.pageX,nowY=e.pageY;
			var disX=nowX-px,disY=nowY-py;

			var t=parseInt(ptop)+disY,l=parseInt(pleft)+disX;
			

			if(!position||!position.posdiy)
			{
				if(t>maxY)
				{
					t=maxY;
				}
				if(t<minY)
				{
					t=minY;
				}
				if(l>maxX)
				{
					l=maxX;
				}
				if(l<minX)
				{
					l=minX;
				}
				
				position&&(position.maxtop!=undefined)&&(position.maxtop<t)?t=position.maxtop:'';
				position&&(position.mintop!=undefined)&&(position.mintop>t)?t=position.mintop:'';
				position&&(position.maxleft!=undefined)&&(position.maxleft<l)?t=position.maxleft:'';
				position&&(position.minleft!=undefined)&&(position.minleft>l)?t=position.minleft:'';
				//console.log('设置移动范围');
			}


			if(position!=undefined&&typeof position.presetcall=='function')
			{
				var pos=position.presetcall({top:t,left:l,mt:id});
				if(pos!=undefined)
				{
					pos.top!=undefined?t=pos.top:'';
					pos.left!=undefined?l=pos.left:'';
					
					pos.setmove!=undefined?setmove=pos.setmove:'';
				}
				e.stopImmediatePropagation();
			}
			
			if(setmove)
			{
				//console.log('正在移动top='+t+',left='+l+',maxX='+maxX+',maxY='+maxY);
				position&&position.x?'':id.css('top',t+"px");
				position&&position.y?'':id.css('left',l+"px");
			}
			

			if(typeof callback=='function')
			{
				var o={id:id,obj:obj,left:l,top:t,e:e};
				callback(o);
			}
		}
		//e.stopImmediatePropagation();
		//px=py=ptop=pleft=0;
	});
}



/*
备用勿删2016/1/23 
function drag(target,movetarget,position,callback)
{
	var px=0;
	var py=0;
	var ptop=0;
	var pleft=0;
	var flag=false;
	
	var width=0;
	var height=0;

	var winX=0;
	var winY=0;

	var maxX=0;
	var maxY=0;

	var id=null;
	var obj=null;
	

	target.mousedown(function(e)
	{
		if(movetarget==undefined||movetarget==null||movetarget=='')
		{
			if($(this).attr('id'))
			{
				id=$("#"+$(this).attr("id"));
				toper.set($(this).attr("id"));
			}
			else
			{
				id=target;
			}
		}
		else
		{
			if(movetarget.attr('id'))
			{
				id=$("#"+movetarget.attr("id"));
				toper.set(movetarget.attr("id"));
			}
			else
			{
				id=movetarget;
			}
		}
		obj=e.target;
	
		ptop=id.css("top").replace('px',"");
		pleft=id.css('left').replace('px',"");

		width=id[0].clientWidth;
		height=id[0].clientHeight;
		
		if(position&&position.maxX!=undefined)
		{
			maxX=position.maxX;
			maxY=position.maxY;
		}
		else
		{
			winX=window.innerWidth||document.body.clientWidth;
			winY=window.innerHeight||document.body.clientHeight;

			maxX=winX-width;
			maxY=winY-height;
		}

		

		flag=true;
		px=e.pageX;
		py=e.pageY;
		//console.log("px="+px+",py="+py);
		e.stopImmediatePropagation();
	});
	$(document).mouseup(function(e)
	{
		flag=false;
		//ptop=id.css("top").replace('px',"");
		//pleft=id.css('left').replace('px',"");
		//e.stopImmediatePropagation();
	});
	$(document).mousemove(function(e)
	{
		if(id==null)
		{
			flag=false;
		}
		if(flag)
		{
			var nowX=e.pageX,nowY=e.pageY;
			var disX=nowX-px,disY=nowY-py;

			var t=parseInt(ptop)+disY,l=parseInt(pleft)+disX;
			if(t>maxY)
			{
				t=maxY;
			}
			if(t<0)
			{
				t=0;
			}
			if(l>maxX)
			{
				l=maxX;
			}
			if(l<0)
			{
				l=0;
			}
			
			position&&(position.maxtop!=undefined)&&(position.maxtop<t)?t=position.maxtop:'';
			position&&(position.mintop!=undefined)&&(position.mintop>t)?t=position.mintop:'';
			position&&(position.maxleft!=undefined)&&(position.maxleft<l)?t=position.maxleft:'';
			position&&(position.minleft!=undefined)&&(position.minleft>l)?t=position.minleft:'';


			position&&position.x?'':id.css('top',t+"px");
			position&&position.y?'':id.css('left',l+"px");
			if(typeof callback=='function')
			{
				var o={id:id,obj:obj,left:l,top:t};
				callback(o);
			}
		}
		//e.stopImmediatePropagation();
		//px=py=ptop=pleft=0;
	});
}

*/




var bottombar=
{
	bar:$("#tinycontent"),
	add:function(fid,uid,cnt)
	{
		if($('#bar_'+fid+'_'+uid).length>0)
		{
			return false;
		}
		var reg=/([a-zA-Z]+)(\d+)/;
		var fd=reg.exec(fid);

		$("#tinycontent").append('<div class="tinycnt tinynone owner_'+uid+'" id="bar_'+fid+'_'+uid+'"><img src="'+usr.getaother(uid,fd[2],fd[1]).img+'"/>'+cnt+'</div>');
		this._bind();
		this.resize();
	},
	_bind:function()
	{
		$(".tinycnt").click(function()
		{
			$(".tinycnt").attr('class','tinycnt tinynone');
			$(this).attr('class',"tinycnt tinyshow");
			$("#"+$(this).attr("id").replace("bar","chatframe")).trigger('click');
		});
	},
	remove:function(fid,uid)
	{
		$("#bar_"+fid+"_"+uid).remove();
		this.resize();
	},
	update:function(fid,uid,cnt)
	{
		$("#bar_"+fid+"_"+uid).html(cnt);
	},
	setimg:function(fid,uid,imgurl)
	{
		$("#bar_"+fid+"_"+uid+" img").attr("src",imgurl);
	}
	,
	resize:function()
	{
		var tnum=$(".tinycnt").length;
		if(tnum<=0)
		{
			return false;
		}
		var twidth=$("#tinycontent")[0].offsetWidth;
		var tleng=$(".tinycnt")[0].offsetWidth;
		var sumleng=tleng*tnum+tnum;
		
		if(sumleng>twidth)
		{
			var newwidth=(twidth/tnum)-3;
			$(".tinycnt").css('width',newwidth+"px");
		}
		else
		{
			$(".tinycnt").css('width',"160px");
		}
	},

	

};


$("#showdesk").mouseover(function()
{

}).mouseout().click();



$(window).resize(bottombar.resize);
$(bottombar.resize);
















$(".disable").click(function()
{
	return false;
});

/*function tips()
{
	$('#mc').remove();  
    $('body').html($('body').html()+'<EMBED id="mc" type="audio/mpeg" src="http://down1.cnmo.com/app/a131/1014.mp3" autostart="true" loop="false" width="0" height="0"/> ');
	console.log("背景音乐");
}*/


//cookie设置
var Cookie=
{
	set:function(c_name,value,expiredays)
	{
		var exdate=new Date();
		exdate.setDate(exdate.getDate()+expiredays);
		document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
	},

	get:function(c_name)
	{
		if(document.cookie.length>0)
		{
			c_start=document.cookie.indexOf(c_name + "=");
			if (c_start!=-1)
			{ 
				c_start=c_start + c_name.length+1; 
				c_end=document.cookie.indexOf(";",c_start);
				if (c_end==-1)
				{
					c_end=document.cookie.length;
				}
				return unescape(document.cookie.substring(c_start,c_end));
			} 
		}
		return false;
	},
	destroy:function(c_name)
	{
		var exdate=new Date();
		exdate.setTime(exdate.getTime()-1);
		document.cookie=c_name+ "=" +''+";expires="+exdate.toGMTString();
	},

	check:function()
	{
		username=getCookie('username');
		if (username!=null && username!="")
		{
			alert('Welcome again '+username+'!');
		}
		else 
		{
			username=prompt('Please enter your name:',"");
			if (username!=null && username!="")
			{
				setCookie('username',username,365);
			}
		}
	},
};
//通用询问构造类
/*
参数 标题名，问题数组，选项类型（多选，单选），映射设置名称
*/
function askbox()
{
	this.init=function(title,quetion_sarray,type,settingname)
	{

	}
}

/*
array(

[0]={
	id:
	status:
	name:
	theme:{}
	group:array(
		[0]={
			id:
			name:
			}
	)
	discus:array(
		[0]={
			id:
			name:
			}
	)
	friend:array(
		[0]={
			frdid:
			frdname:
			}
	)
	msgbox:array(
		[0]={
			fromid:
			type:
			cnt:array(
				[0]={fromid,toid,content,time}
				)
			}

		)
	msgindex:array(
		[0]={
			uid
			senderid
			type:
			readid
			}

		)
	}
	


)


usr_msg[0].name
usr_msg[0].msgbox[0].cnt[0].content
usr_msg[0].friends[0].frdid
*/


/*
info 数组
checkall()			获取整个对象
adduser(user obj) 添加一个用户对象进info
getuser(attr,type) 通过id或account 查找用户对象 type:id/acc type不写默认id
getallid()			获取所有用户id
getall(uid)			通过id获取该用户整个对象
removeuser(uid)		通过id移除该用户整个对象
setpro(uid,obj,attr,val)		设置或添加用户对象的属性和值 val不写即为添加操作（info[uid].obj=attr） val写即为设置操作(info[uid].obj.attr=val)

addother(uid,obj,type)			添加一个好友/群组/讨论组/对象进用户对象 type=friend/group/discus 不写默认friend

getaother(uid,fid,type)			获取一个好友/群组/讨论组/对象 type=friend/group/discus 不写默认friend
getother(uid,type)				获取某个用户的所有好友/群组/讨论组/对象 type=friend/group/discus 不写默认friend

addmsg(uid,msgobj,type)			添加一条信息进msgbox对象 type=frd/grp/dis/newinfo/sys 不写默认frd          sendertype（friend,group,discus,newsinfo,sys）
create_addmsg(uid,sid,msgarr,type) 给

getamsg(uid,senderid,type)		获取用户的某个发送者的所有信息 type=frd/grp/dis/newinfo/sys 不写默认frd
getmsg(uid)						获取用户的所有信息 type=frd/grp/dis/newinfo/sys 不写默认frd

removeamsg(uid,senderid,type)	移除用户的某个发送者的所有信息 type=frd/grp/dis/newinfo/sys 不写默认frd
removemsg(uid)					移除用户的所有信息 type=frd/grp/dis/newinfo/sys 不写默认frd
getfrdsid(uid)					获取所有好友id

//设置/添加info中某对象的内部属性值
set2pro(uid,proname,proidname,proidval,attr,val)
*/

function User()
{
	var info=null;

	this.checkall=function()
	{
		return info;
	}

	this.adduser=function(obj)
	{
		if(obj!=null||obj!=undefined)
		{
			if(info==null)
			{
				info=new Array();
			}
			info.push(obj);
			return true;
		}
	}
	this.getuser=function(attr,type)
	{
		if(type==undefined||type==null)
		{
			type='id';
		}
		
		if(info==null||info.length<=0)
		{
			return false;
		}
		if(type=='id')
		{
			for(var i=0;i<info.length;i++)
			{
				if(info[i].id==attr)
				{
					var usr={};
					usr.name=info[i].name;
					usr.id=info[i].id;
					usr.img=info[i].imghead_60;
					usr.img30=info[i].imghead_30;
					usr.img100=info[i].imghead_100;
					usr.imggray=info[i].imghead_gray;
					usr.imghd=info[i].imghead_normal;
					//usr.img=info[i].img;
					usr.sign=info[i].sign;
					usr.isvip=info[i].isvip;
					usr.account=info[i].account;
					usr.theme=info[i].theme;
					usr.birthday=info[i].birthday;
					usr.hometown=info[i].hometown;
					usr.livetown=info[i].livetown;
					usr.email=info[i].email;
					usr.sex=info[i].sex;
					usr.introcard_skin=info[i].introcard_skin;
					return usr;
				}
				
			}
		}
		else if(type=='acc')
		{
			for(var i=0;i<info.length;i++)
			{
				if(info[i].account==attr)
				{
					var usr={};
					usr.name=info[i].name;
					usr.id=info[i].id;
					usr.img=info[i].img;
					usr.sign=info[i].sign;
					usr.account=info[i].account;
					usr.theme=info[i].theme;
					return usr;
				}
				
			}
		}
		
		return false;

	}

	this.getallid=function()
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		var a=[];
		for(var i=0;i<info.length;i++)
		{
			a.push(info[i].id);
		}
		return a;
	}


	this.getall=function(uid)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				return info[i];
			}
		}
	}
	this.removeuser=function(uid)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				info.remove(i);
				return true;
			}
		}

	}

	/*
	set or add a  obj (only for info's subobj)

	add(uid,obj's content)
	set(uid,obj.attr,obj.attr->val)
	*/
	this.setpro=function(uid,obj,attr,val)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		//set status
		if(val!=undefined)
		{
			for(var i=0;i<info.length;i++)
			{
				if(info[i].id==uid)
				{
					info[i][obj][attr]=val;
					return true;
				}
			}
		}
		// add status
		else
		{
			for(var i=0;i<info.length;i++)
			{
				if(info[i].id==uid)
				{
					info[i][obj]=attr;
					return true;
				}
			}
		}
	}

	/*
	get a  obj value(only for info's subobj)

	get(uid,obj's content)
	get(uid,obj.attr,obj.attr->val)
	*/
	this.getpro=function(uid,obj,attr)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		//set status
		if(attr!=undefined)
		{
			for(var i=0;i<info.length;i++)
			{
				if(info[i].id==uid&&info[i][obj]!=undefined&&info[i][obj][attr]!=undefined)
				{
					return info[i][obj][attr];
				}
			}
			return false;
		}
		// add status
		else
		{
			for(var i=0;i<info.length;i++)
			{
				if(info[i].id==uid&&info[i][obj]!=undefined)
				{
					return info[i][obj];
				}
			}
			return false;
		}
	}

	/*
	add friends or groups or discus
	*/
	this.addother=function(uid,obj,type)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		if(type==undefined||type==null)
		{
			type='frd';
		}
		if(type!='grp'&&type!='frd'&&type!='dis')
		{
			return false;
		}
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i][type]==undefined||info[i][type]==null)
				{
					info[i][type]=[];
				}
				obj.id=obj.frdid||obj.gid||obj.did||obj.id;
				info[i][type].push(obj);
				return true;
			}
		}	
	}
	/*
	get a friends or groups or discus 
	type default 'friend'
	*/
	this.getaother=function(uid,fid,type)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		if(type==undefined||type==null)
		{
			type='frd';
		}
		if(type!='grp'&&type!='frd'&&type!='dis')
		{
			return false;
		}
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i][type]==undefined||info[i][type]==null||info[i][type].length<=0)
				{
					return false;
				}
				for(var k=0;k<info[i][type].length;k++)
				{
					if(info[i][type][k].id==fid)
					{
						return info[i][type][k];
					}
				}

			}
			
		}
		return false;
	}

	/*

	*/
	this.getother=function(uid,type)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		if(type==undefined||type==null)
		{
			type='frd';
		}
		if(type!='grp'&&type!='frd'&&type!='dis')
		{
			return false;
		}
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i][type]==undefined||info[i][type]==null||info[i][type].length<=0)
				{
					return false;
				}
				
				return info[i][type];
			}
			
		}
		return false;
	}

	//设置/添加info动态添加的某对象的内部属性值
	this.set2pro=function(uid,proname,proidname,proidval,attr,val)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i][proname]!=undefined)
				{
					for(var k=0;k<info[i][proname].length;k++)
					{
						if(info[i][proname][k][proidname]==proidval)
						{
							info[i][proname][k][attr]=val;
							//console.log('info['+i+']['+proname+']['+k+']['+attr+']='+val);
							return true;
						}
					}
					return false;
				}
				return false;
				
			}
		}
		return false;
	}
	
	//从info动态添加的某对象中获取元素
	this.get4pro=function(uid,proname,proidname,proidval,attr)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i][proname]!=undefined)
				{
					for(var k=0;k<info[i][proname].length;k++)
					{
						if(info[i][proname][k][proidname]==proidval)
						{
							return info[i][proname][k][attr];
						}
					}
					return false;
				}
				return false;
				
			}
		}
		return false;
	}

	/*
	获取所有好友id
	*/
	this.getfrdsid=function(uid)
	{
		var frds=this.getother(uid,'frd');
		if(frds)
		{
			var rs=[];
			for(var i=0;i<frds.length;i++)
			{
				rs.push(frds[i].id);
			}
			return rs;
		}
		return false;
	}









	this.getmsgindex=function(uid,senderid,type)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		if(type==undefined||type==null)
		{
			type='frd';
		}
		if(type!='frd'&&type!='grp'&&type!='dis'&&type!='newsinfo'&&type!='addfrd'&&type!='grpsys')
		{
			return false;
		}
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i].msgindex==null||info[i].msgindex==undefined)
				{
					return false;
				}
				for(var k=0;k<info[i].msgindex.length;k++)
				{
					if(info[i].msgindex[k].type==type&&info[i].msgindex[k].senderid==senderid)
					{
						return info[i].msgindex[k].readid;
					}
				}
			}
			return false;

		}

	}

	this.getallmsgindex=function(uid)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		
		var str='';
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i].msgindex==null||info[i].msgindex==undefined)
				{
					return false;
				}
				
				for(var k=0;k<info[i].msgindex.length;k++)
				{
					str+=info[i].msgindex[k].type+'-'+info[i].msgindex[k].senderid+'-'+info[i].msgindex[k].readid+',';
				}
			}
			return str;

		}

	}




	/*
		add a msg into msgbox
		type:
		{
			friend
			group
			discus
			newinfo
			addfrd
			sys
		}
	*/
	this.addmsg=function(uid,sid,msgobj,type)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		if(type==undefined||type==null)
		{
			type='frd';
		}
		if(type!='frd'&&type!='grp'&&type!='dis'&&type!='newsinfo'&&type!='addfrd'&&type!='grpsys')
		{
			return false;
		}
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i].msgbox==undefined||info[i].msgbox==null)
				{
					info[i].msgbox=[];
				}
				var flag=1;
				for(var k=0;k<info[i].msgbox.length;k++)
				{
					if(info[i].msgbox[k].fromid==sid&&info[i].msgbox[k].type==type)
					{
						if(info[i].msgbox[k].cnt==undefined||info[i].msgbox[k].cnt==null)
						{
							info[i].msgbox[k].cnt=[];
						}
						info[i].msgbox[k].cnt.push(msgobj);
						flag=0;
						break;
					}
				}
				if(flag)
				{
					var a={};
					a.fromid=sid;
					a.type=type;
					a.cnt=[];
					a.cnt.push(msgobj);
					info[i].msgbox.push(a);
				}
				return true;
			}
		}
	}

	this.create_addmsg=function(uid,sid,msgarr,type)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		if(type==undefined||type==null)
		{
			type='frd';
		}
		if(type!='frd'&&type!='grp'&&type!='dis'&&type!='newsinfo'&&type!='addfrd'&&type!='grpsys')
		{
			return false;
		}
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i].msgbox==undefined||info[i].msgbox==null)
				{
					info[i].msgbox=[];
				}
				
				var a={};
				a.fromid=sid;
				a.type=type;
				a.cnt=msgarr;
				info[i].msgbox.push(a);
				
				return true;
			}
		}
	}
	
	/*
	get all msg which for user
	*/
	this.getmsg=function(uid)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		var msg=false;
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				msg=info[i].msgbox;
				info[i].msgbox=[];
				//return msg;
				break;
			}
		}
		return msg;

	}
	/*
	remove all msg which for user
	*/
	this.removemsg=function(uid)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				info[i].msgbox=[];
				return true;
			}
		}	
	}

	/*
	get then remove someone's all msg
	*/
	this.getamsg=function(uid,senderid,type)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		if(type==undefined||type==null)
		{
			type="frd";
		}
		if(type!='frd'&&type!='grp'&&type!='dis'&&type!='newsinfo'&&type!='addfrd'&&type!='grpsys')
		{
			return false;
		}
		
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i].msgbox==undefined||info[i].msgbox==null)
				{
					info[i].msgbox=[];
				}
				for(var k=0;k<info[i].msgbox.length;k++)
				{
					if(info[i].msgbox[k].fromid==senderid&&info[i].msgbox[k].type==type)
					{
						var amsg=false;
						amsg=info[i].msgbox[k];
						//移除消息
						info[i].msgbox.remove(k);
						return amsg;
					}
				}
			}
			
		}
		return false;
	
	}
	/*
	get then remove user's all msg by type
	*/
	this.gettypemsg=function(uid,type)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		if(type==undefined||type==null)
		{
			type="frd";
		}
		if(type!='frd'&&type!='grp'&&type!='dis'&&type!='newsinfo'&&type!='addfrd'&&type!='grpsys')
		{
			return false;
		}
		
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i].msgbox==undefined||info[i].msgbox==null)
				{
					info[i].msgbox=[];
				}
				var typemsg=[];
				for(var k=0;k<info[i].msgbox.length;k++)
				{
					if(info[i].msgbox[k].type==type)
					{
						
						typemsg.push(info[i].msgbox[k]);
						//移除消息
						info[i].msgbox.remove(k);
						continue;
					}
				}
				if(typemsg.length>0)
				{
					return typemsg;
				}
				return false;
			}
			
		}
		return false;
	
	}
	/*
	remove someone's all msg
	*/
	this.removeamsg=function(uid,senderid,type)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		if(type==undefined||type==null)
		{
			type="frd";
		}
		if(type!='frd'&&type!='grp'&&type!='dis'&&type!='newsinfo'&&type!='addfrd'&&type!='grpsys')
		{
			return false;
		}
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i].msgbox==undefined||info[i].msgbox==null||info[i].msgbox.length<=0)
				{
					return false;
				}
				for(var k=0;k<info[i].msgbox.length;k++)
				{
					if(info[i].msgbox[k].fromid==senderid&&info[i].msgbox[k].type==type)
					{
						info[i].msgbox.remove(k);
						return true;
					}
				}
			}
			
		}
		return false;
	}
	
	/*
	only get someone's all msg
	*/
	this.getomsg=function(uid,senderid,type)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		if(type==undefined||type==null)
		{
			type="frd";
		}
		if(type!='frd'&&type!='grp'&&type!='dis'&&type!='newsinfo'&&type!='addfrd'&&type!='grpsys')
		{
			return false;
		}
		
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i].msgbox==undefined||info[i].msgbox==null)
				{
					info[i].msgbox=[];
				}
				for(var k=0;k<info[i].msgbox.length;k++)
				{
					if(info[i].msgbox[k].fromid==senderid&&info[i].msgbox[k].type==type)
					{
						return info[i].msgbox[k];
					}
				}
			}
			
		}
		return false;
	
	}

	/*
	only get user all msg
	*/
	this.getallmsg=function(uid)
	{
		if(info==null||info.length<=0)
		{
			return false;
		}
		
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i].msgbox==undefined||info[i].msgbox==null)
				{
					return false;
				}
				else
				{
					return info[i].msgbox;
				}
			}
			
		}
		return false;
	
	}


	/*
		添加设置最近联系
	*/
	this.setlast=function(uid,type,senderid)
	{
		senderid==undefined?senderid=0:'';
		if(info==null||info.length<=0)
		{
			return false;
		}
		
		for(var i=0;i<info.length;i++)
		{
			if(info[i].id==uid)
			{
				if(info[i].lastcnt==undefined||info[i].lastcnt==null)
				{
					return false;
				}
				else
				{
					var last=info[i].lastcnt;
					var ls=type+':'+senderid;
					//console.log('last='+last);
					if(last.length==0)
					{
						info[i].lastcnt=ls+',';
					}
					else
					{
						//last.indexOf(ls)>=0?last.replace(ls,''):'';

						//last=ls+last;
						
						var larr=last.split(',');
						for(var k=0;k<larr.length;k++)
						{
							if(k>8||larr[k]==ls)
							{
								larr.remove(k);
							}
						}
						
						info[i].lastcnt=ls+','+larr.join(',');
					}
				}
				return true;
			}
			
		}
		return false;
	
	}




	
	

}

var usr=new User();




/*
输入框中的图片对象保存对象


*/

function Img()
{
	var imgcan=null;
	
	/*
	imgcan
	[

		[0]={
				uid:
				fid:
				objs:
				[
					[0]={
							id:
							obj:
						}
				]
			}
		
	
	]

	imgcan[0].obj
		
	*/

	this.add=function(uid,fid,imgid,imgobj,imgsrc)
	{
		var fid=parseInt(fid);
		var uid=parseInt(uid);
		if(imgcan==null||imgcan.length<=0)
		{
			imgcan=[];
			var a={};
			a.fid=fid;
			a.uid=uid;
			a.objs=[];
			a.objs.push({'id':imgid,'obj':imgobj,'src':imgsrc});
			imgcan.push(a);
			return true;
		}
		else
		{
			for (var i=0;i<imgcan.length;i++)
			{
				if(imgcan[i].uid==uid&&imgcan[i].fid==fid)
				{
					imgcan[i].objs.push({'id':imgid,'obj':imgobj,'src':imgsrc});
					return true;
				}	
			}

			var a={};
			a.fid=fid;
			a.uid=uid;
			a.objs=[];
			a.objs.push({'id':imgid,'obj':imgobj,'src':imgsrc});
			imgcan.push(a);
			return true;
		}
		
	}
	this.viewall=function()
	{
		return imgcan;
	}

	this.get=function(uid,fid,imgid)
	{
		if(imgcan==null||imgcan.length<=0)
		{
			return false;
			
		}
		
		for (var i=0;i<imgcan.length;i++)
		{
			if(imgcan[i].uid==parseInt(uid)&&imgcan[i].fid==parseInt(fid))
			{
				if(imgcan[i].objs==null||imgcan[i].objs.length<=0)
				{
					return false;
				}
				for(var k=0;k<imgcan[i].objs.length;k++)
				{
					if(imgcan[i].objs[k].id==imgid)
					{
						var obj=imgcan[i].objs[k].obj;
						//imgcan[i].objs.remove(k);
						return obj;
					}
				}
				return false;
			}	
		}
		return false;
		
	}
	this.remove=function(uid,fid,imgid)
	{
		if(imgcan==null||imgcan.length<=0)
		{
			return false;
			
		}
		
		for (var i=0;i<imgcan.length;i++)
		{
			if(imgcan[i].uid==parseInt(uid)&&imgcan[i].fid==parseInt(fid))
			{
				if(imgcan[i].objs==null||imgcan[i].objs.length<=0)
				{
					return false;
				}
				for(var k=0;k<imgcan[i].objs.length;k++)
				{
					if(imgcan[i].objs[k].id==imgid)
					{
						//var obj=imgcan[i].objs[k].obj;
						imgcan[i].objs.remove(k);
						//return obj;
						return true;
					}
				}
				return false;
			}	
		}
		return false;
	}

	this.getall=function(uid,fid)
	{
		if(imgcan==null||imgcan.length<=0)
		{
			return false;
			
		}
		
		for (var i=0;i<imgcan.length;i++)
		{
			if(imgcan[i].uid==parseInt(uid)&&imgcan[i].fid==parseInt(fid))
			{
				if(imgcan[i].objs==null||imgcan[i].objs.length<=0)
				{
					return false;
				}
				var objs=imgcan[i].objs;
				
				imgcan.remove(i);
				return objs;
			}	
		}
		return false;
	}

	this.removeall=function(uid,fid)
	{
		if(imgcan==null||imgcan.length<=0)
		{
			return false;
			
		}
		
		for (var i=0;i<imgcan.length;i++)
		{
			if(imgcan[i].uid==parseInt(uid)&&imgcan[i].fid==parseInt(fid))
			{
				imgcan.remove(i);
				return true;
			}	
		}
		return false;
	}

}

var img_ids=new Img();



/*
临时变量管理对象
*/

var tempval=
{
	//userset:null,
	setone:function(uid,type,attr,val)
	{
		if(this[type]==null||this[type]==undefined)
		{
			this[type]=[];
			var k={};
			k.id=parseInt(uid);
			k[attr]=val;
			this[type].push(k);
			return;
		}
		else
		{
			for(var i=0;i<this[type].length;i++)
			{
				if(this[type][i].id==parseInt(uid))
				{
					this[type][i][attr]=val;
					return;
				}
			}

			var k={};
			k.id=parseInt(uid);
			k[attr]=val;
			this[type].push(k);

		}
		






	},
	getone:function(uid,type,attr)
	{
		if(this[type]==undefined||this[type]==null)
		{
			return false;
		}
		for(var i=0;i<this[type].length;i++)
		{
			if(this[type][i].id==parseInt(uid))
			{
				if(this[type][i][attr]!=undefined)
				{
					return this[type][i][attr];
				}
				else
				{
					return false;
				}
			}
		}
		return false;
	},
	getoneall:function(uid,type)
	{
		if(this[type]==undefined||this[type]==null/*||this[type].length<=0*/)
		{
			return false;
		}
		for(var i=0;i<this[type].length;i++)
		{
			if(this[type][i].id==parseInt(uid))
			{
				return this[type][i];	
			}
		}
		return false;
	},
	cleanoneall:function(uid,type)
	{
		if(this[type]==undefined||this[type]==null/*||this[type].length<=0*/)
		{
			return false;
		}
		for(var i=0;i<this[type].length;i++)
		{
			if(this[type][i].id==parseInt(uid))
			{
				this[type].remove(i);	
			}
		}
		return false;
	},
	cleanall:function(type)
	{
		this[type]=undefined;
	},


};





/*
获取n个随机码
*/
function getrand(n)
{
	var chars = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
	var str='';
	for(var i=0;i<n;i++)
	{
		var index=Math.ceil(Math.random()*35);
		str+=chars[index];
	}
	return str;
}






/*
聊天框内容置底
*/
function tobottom(fid,uid)
{
	//var offset=$("#chatframe_"+fid+"_"+uid+" .chatbox")[0].clientHeight-$("#chatcntpage_"+fid)[0].offsetHeight;
	var offset=$('#chatbox_'+fid+'_'+uid)[0].clientHeight-$("#chatbox_"+fid+"_"+uid+" .chatcntpage")[0].offsetHeight;
	if(offset<0)
	{
		$("#chatframe_"+fid+"_"+uid+" .chatcntpage").css('top',offset-10+"px");
	}
}

/*
聊天框内容置顶
*/
function totop(fid,uid)
{
	$("#chatframe_"+fid+"_"+uid+" .chatcntpage").css('top',"0px");
}




/*
图标地址对象
*/
var imgbank=
{
	online:'img/status/qq/imonline.png',
	offline:'',


	news:'',
	discount:'',
	sys:'',
	
	
};






/*
用户设置数组

用户登录时获取，在设置面板更改时更改


user_setting

id name type content grp intro


type:0 是否    
	:1 单选
	:2 填写
	:12 单选后填写
	:x2点选后填写
content: 0/1
		 0/1/2/3/...
		 空或默认值或用户填写
		 0;空或 1/2/..;默认值或用户填写



var setting[0].logset.autolog={
								type:2,
								set:0
								}

*/









/*

------------------------通用滚动条设置-------------------------

		---------------------------------------------
		|		    board	relative         |--|	|
		| -----------------------------      |  |   |
		||           cnt	absolute   |	 |  |	|
		||	-------------------------  |	 |  |	|
		||	|						|  |	 |  |---|--------scroll absolute	
		||	|					    |  |	 |  |	|
		||	|					    |  |	 |  |	|
		||	|		page relative   |  |	 |  |	|
		||	|					    |  |	 |  |	|
		||	|					    |  |	 |  |	|
		| -----------------------------	     |--|	|
		---------------------------------------------




board   总内容版 固定宽高
cnt     包裹可滚动页的内容框 固定宽高 防止滚动页溢出造成div样式崩溃
page	滚动内容页 固定宽度 高度最小100%
scroll	滚动条框	固定宽高
1
<div class="simplescrollframe">
	<div class="scroll_topstep"><div class="scroll_topstepbtn"></div></div>
	<div class="scroll_scrollbar"><div class="scroll_scrollblock"></div></div>
	<div class="scroll_bottomstep"><div class="scroll_bottomstepbtn"></div></div>
</div>

2
<div class="entirescrollframe">
	<div class="scroll_totop"></div>

	<div class="simplescrollframecnt">
		<div class="scroll_topstep"><div class="scroll_topstepbtn"></div></div>
		<div class="scroll_scrollbar"><div class="scroll_scrollblock"></div></div>
		<div class="scroll_bottomstep"><div class="scroll_bottomstepbtn"></div></div>
	</div>

	<div class="scroll_tobottom"></div>
</div>

3
<div class="tinyscroll">
	<div class="tinyscrollblock"></div>
</div>

使用此对象注意
1，仅用于设置滚动条，则使用Scroll.reset
2，要使滚动页滚动，则在board的mouseover中添加Scroll.set即可
3, 设置滚动块css时需标好top

Scroll.set(board,cnt,page,scrolltype,callback)

*/


var Scroll=
{
	add:function(board,cnt,page,scrolltype)
	{
		var winy=cnt[0].clientHeight;
		var scrollclass=null;
		switch(parseInt(scrolltype))
		{
			case 1:
				scrollclass="simplescrollframe";
				break;
			case 2:
				scrollclass="entirescrollframe";
				break;
			case 3:
				scrollclass="tinyscroll";
				break;
			default:
				scrollclass="simplescrollframe";
		}
		var scrollhtml=null;
		
		if(parseInt(scrolltype)==1)
		{
			scrollhtml='<div class="simplescrollframe"><div class="scroll_topstep"><div class="scroll_topstepbtn"></div></div><div class="scroll_scrollbar"><div class="scroll_scrollblock"></div></div><div class="scroll_bottomstep"><div class="scroll_bottomstepbtn"></div></div></div>';
		}
		else if(parseInt(scrolltype)==2)
		{
			scrollhtml='<div class="entirescrollframe"><div class="scroll_totop"><div class="scroll_totopbtn"></div></div><div class="simplescrollframecnt"><div class="scroll_topstep"><div class="scroll_topstepbtn"></div></div><div class="scroll_scrollbar"><div class="scroll_scrollblock"></div></div><div class="scroll_bottomstep"><div class="scroll_bottomstepbtn"></div></div></div><div class="scroll_tobottom"><div class="scroll_tobottombtn"></div></div></div>';
		}
		else if(parseInt(scrolltype)==3)
		{
			scrollhtml='<div class="tinyscroll"><div class="tinyscrollblock"></div></div>';
		}
		
		//console.log('add scrolltype='+scrolltype);
		//console.log('scrollhtml='+scrollhtml);

		//board.css("position","relative");//2015/10/28废除
		//cnt.css("position","absolute").css("top","0").css("left","0");
		//内容框缩小14px（迷你滚动条的话缩小10px）
		(parseInt(scrolltype)==3)?cnt.css("width",(parseInt(cnt.css("width").replace("px",""))-10)+"px"):cnt.css("width",(parseInt(cnt.css("width").replace("px",""))-14)+"px");
		//总内容板加入滚动框
		board.append(scrollhtml);
		//设置滚动框高度(迷你滚动条不需设置)
		if(parseInt(scrolltype)==1)
		{
			board.find(".scroll_scrollbar").css("height",(winy-24)+"px");
		}
		else if(parseInt(scrolltype)==2)
		{
			board.find(".simplescrollframecnt").css("height",(winy-24)+"px");
			board.find(".scroll_scrollbar").css("height",(winy-48)+"px");
		}


		/*board.find(".scroll_topstep").click(function()
		{
			
			
		});

		*/

		return board.find("."+scrollclass);
	}
	,
	reset:function(board,cnt,page,scrolltype)
	{
		if(board[0]==undefined||cnt[0]==undefined||page[0]==undefined)
		{
			//console.log('对象不正确，无法设置滚动');
			return false;
		}
		var winy=cnt[0].clientHeight;
		var pagey=page[0].offsetHeight;
		scrolltype=(scrolltype==undefined||scrolltype=='')?1:scrolltype;
		//console.log('reset2 scrolltype='+scrolltype);
		//var scrollclass=parseInt(scrolltype)==1?"simplescrollframe":"entirescrollframe";
		var scrollclass=null;
		switch(parseInt(scrolltype))
		{
			case 1:
				scrollclass="simplescrollframe";
				break;
			case 2:
				scrollclass="entirescrollframe";
				break;
			case 3:
				scrollclass="tinyscroll";
				break;
			default:
				scrollclass="simplescrollframe";
		}
		var scrollobj=board.find("."+scrollclass);

		//设置滚动框高度(迷你滚动条不需设置)
		if(parseInt(scrolltype)==1)
		{
			board.find(".scroll_scrollbar").css("height",(winy-24)+"px");
		}
		else if(parseInt(scrolltype)==2)
		{
			board.find(".simplescrollframecnt").css("height",(winy-24)+"px");
			board.find(".scroll_scrollbar").css("height",(winy-48)+"px");
		}

		//如果高度不超出内容框，则移除滚动框
		if(pagey<=winy)
		{
			//console.log("滚动页高度小于等于窗口高度，取消滚动 winy="+winy+"pagey="+pagey);
			/*
			如果滚动页高度小于等于内容框，移除滚动框，并将内容框宽度调至100%
			*/
			//console.log('board=');
			//console.log(board.find("."+scrollclass));
			board.find("."+scrollclass).length>0?board.find("."+scrollclass).remove():'';
			page.css('top','0');
			cnt.css("width","100%");
			//this.clear(board);
			return false;
		}
		//如果尚未设置滚动框,则添加设置
		if(scrollobj.length<=0)
		{
			scrollobj=this.add(board,cnt,page,scrolltype);
		}

		var pagetop=parseInt(page.css('top').replace('px','').replace('-',''));

		//滚动块长度计算   
		/*
			 显示高度      滚动滑块长度
			---------- == --------------
			页面总高度     滚动条总长度(显示高度-上下按钮高度)

			得出 【滑块长度=显示高度*(显示高度-上下按钮高度)/页面总高度】

		*/

		var blockhe=(parseInt(scrolltype)==3)?(winy*winy/pagey):(winy*(winy-24)/pagey);

		//滚动块平移高度计算
		/*
			页面的平移高度(offsettop or top)     滑块平移高度
			-------------------------------- == ----------------
			         页面总高度                  滚动条总长度(显示高度-上下按钮高度)

			得出  【滑块平移高度=页面的平移高度*(显示高度-上下按钮高度)/页面总高度】

			或    【滑块平移高度=页面的平移高度/页面总高度 *(显示高度-上下按钮高度)】
					即已滚去百分比*滚动条总长度
		*/

		var blocktop=(parseInt(scrolltype)==3)?(pagetop*winy/pagey):(pagetop*(winy-24)/pagey);

		
		(parseInt(scrolltype)==3)?scrollobj.find(".tinyscrollblock").css("height",blockhe+"px").css("top",blocktop+"px"):scrollobj.find(".scroll_scrollblock").css("height",blockhe+"px").css("top",blocktop+"px");
		//var block=scrollobj.find(".scroll_scrollblock");
		return scrollobj;
	}
	,
	set:function(board,cnt,page,scrolltype,callback)
	{
		//console.log('set scrolltype='+scrolltype);
		scrolltype=(scrolltype==undefined||scrolltype=='')?1:scrolltype;
		
		var scrollobj=this.reset(board,cnt,page,scrolltype);
		if(scrollobj==false)
		{
			//console.log("scrollobj=false");
			return false;
		}

		if(document.addEventListener){
			document.addEventListener('DOMMouseScroll',scrollselect,false);
		} 
		window.onmousewheel=document.onmousewheel=scrollselect;
			
		function scrollselect(e)
		{
			e=e||window.event;
			if(e.wheelDelta)
			{
				//console.log("wheelDelta="+e.wheelDelta);
				scroll(e.wheelDelta,'a');
			}
			else if(e.detail,'b')
			{
				//console.log("detail="+e.detail);
				scroll(e.detail,'b');
			}
		}

		function scroll(x,flag)
		{
			var step=0;
			
			var blockh=(parseInt(scrolltype)==3)?scrollobj.find(".tinyscrollblock")[0].offsetHeight:scrollobj.find(".scroll_scrollblock")[0].offsetHeight;
			var blockt=(parseInt(scrolltype)==3)?scrollobj.find(".tinyscrollblock").css("top").replace("px",""):scrollobj.find(".scroll_scrollblock").css("top").replace("px","");
			var barh=(parseInt(scrolltype)==3)?scrollobj[0].offsetHeight:scrollobj.find(".scroll_scrollbar")[0].offsetHeight;
			
			//console.log('blockh='+blockh+' blockt='+blockt+' barh='+barh);
			//已经走过的高度
			var runed=blockt;
			//剩余高度
			var left=barh-runed;

			//滚动速率根据滚轮长度变化
			//blockh<50?blockh=50:'';
			var steptimes=Math.round(blockh/50);
			steptimes<1?steptimes=1:'';
			if(x>0&&flag=='a'||x<0&&flag=='b')
			{
				step=-1*steptimes*0.01;
			}
			else if(x<0&&flag=='a'||x>0&&flag=='b')
			{
				step=1*steptimes*0.01;
			}
			var per=runed/barh+step;
			
			/*
			console.log("per="+per);
			console.log("runed="+runed);
			console.log("barh="+barh);
			console.log("step="+step);
			*/
			if(per<0)
			{
				per=0;
				//get history
			}
			if(per>=1)
			{
				per=1;
			}
			var go=per*barh;
			if(go>=(barh-blockh))
			{
				go=barh-blockh;
			}
			var topover=-per*page[0].offsetHeight;
			if(-topover>=page[0].offsetHeight)
			{
				topover=-page[0].offsetHeight
			}
			
			/*console.log('per='+per);
			console.log('go='+go);
			console.log('topover='+topover);
			console.log();
			*/
			(parseInt(scrolltype)==3)?scrollobj.find(".tinyscrollblock").css('top',go+'px'):scrollobj.find(".scroll_scrollblock").css('top',go+'px');
			page.css('top',topover+'px');

			if(typeof callback=='function')
			{
				isbottom=(go>=(barh-blockh))?1:0;
				callback({board:board,cnt:cnt,page:page,scrollobj:scrollobj,scrolltop:go,pagetop:topover,isbottom:isbottom});
			}
			
			
		}

		this.release(board);
	}
	,
	gotop:function(board,cnt,page,scrolltype)
	{
		scrolltype=(scrolltype==undefined)?1:scrolltype;
		
		var scrollobj=this.reset(board,cnt,page,scrolltype);
		if(scrollobj==false)
		{
			//console.log("scrollobj=false");
			return false;
		}
		(parseInt(scrolltype)==3)?scrollobj.find(".tinyscrollblock").css('top','0'):scrollobj.find(".scroll_scrollblock").css('top','0');
		page.css('top','0');
	}
	,
	release:function(obj)
	{
		obj.mouseout(function()
		{
			window.onmousewheel=document.onmousewheel=null;
		});
	}
	,
	clear:function(obj)
	{
		obj.mouseover(function()
		{
			window.onmousewheel=document.onmousewheel=null;
		}).mouseout(function()
		{
			window.onmousewheel=document.onmousewheel=null;
		});
	}
	,

};

//通过邮箱账号找链接
function getmailurl(email)
{
	var hash = {
			'qq.com': 'http://mail.qq.com',
			'gmail.com': 'http://mail.google.com',
			'sina.com': 'http://mail.sina.com.cn',
			'163.com': 'http://mail.163.com',
			'126.com': 'http://mail.126.com',
			'yeah.net': 'http://www.yeah.net/',
			'sohu.com': 'http://mail.sohu.com/',
			'tom.com': 'http://mail.tom.com/',
			'sogou.com': 'http://mail.sogou.com/',
			'139.com': 'http://mail.10086.cn/',
			'hotmail.com': 'http://www.hotmail.com',
			'live.com': 'http://login.live.com/',
			'live.cn': 'http://login.live.cn/',
			'live.com.cn': 'http://login.live.com.cn',
			'189.com': 'http://webmail16.189.cn/webmail/',
			'yahoo.com.cn': 'http://mail.cn.yahoo.com/',
			'yahoo.cn': 'http://mail.cn.yahoo.com/',
			'eyou.com': 'http://www.eyou.com/',
			'21cn.com': 'http://mail.21cn.com/',
			'188.com': 'http://www.188.com/',
			'foxmail.com': 'http://www.foxmail.com',
			'outlook.com': 'http://www.outlook.com'
		}
		var _tab=email.split('@')[1];
		return hash[_tab];
}


//getxmlval('LocList',['CountryRegion','State','City'],['country','province','city'],1,0);

function getxmlval(file,callback)
{
	$.ajax({
		url:"xmllib/"+file+".xml",
        dataType: 'xml',
        type: 'GET',
		async:false,
        error:function(xml)
        {
			console.log("加载XML 文件出错！");
			//return false;
        },
        success:callback,
	});
}


//只要加载了这一个，下面子孙均以第一个元素出现

function setselect(obj,xmlname,needname,lv,flag)
{
	/*
	var need='';
	obj.find(xmlname[lv-1]).each(function(i)
	{
		if(flag!=undefined)
		{
			if($(this).attr('Code')==flag)
			{
				setselect($(this),xmlname,needname,lv+1);
			}
		}
		else
		{
			//从中挑出第一个进行下一次加载
			if(i==0)
			{
				setselect($(this),xmlname,needname,lv+1);
			}
		}

		need+=$(this).attr('Code')==undefined?'':'<option value="'+$(this).attr('Code')+'">'+$(this).attr('Name')+'</option>';
	});
	
	 $('select[name="'+needname[lv-1]+'"]').html(need);

	 */

	var need='';
	obj.find(xmlname[lv-1]).each(function(i)
	{
		if(flag!=undefined)
		{
			var ts=$(this);
			obj.find(xmlname[(lv-1)-1]).each(function()
			{
				if($(this).attr('Code')==flag)
				{
					setselect($(this),xmlname,needname,lv+1);
				}
			})
			
		}
		else
		{
			//从中挑出第一个进行下一次加载
			if(i==0)
			{
				setselect($(this),xmlname,needname,lv+1);
			}
		}

		need+=$(this).attr('Code')==undefined?'':'<option value="'+$(this).attr('Code')+'">'+$(this).attr('Name')+'</option>';
	});
	
	 $('select[name="'+needname[lv-1]+'"]').html(need);
}


/*
最终版 2016/1/6凌晨2:27
*/
function getxmlchild(obj,xmlname,lv,flag)
{
	var need={};
	for(var i=0;i<xmlname.length;i++)
	{
		need[xmlname[i]+'']=[];
	}
	//console.log(flag);
	
	var getchild=function(obj,xmlname,lv,flag)
	{
		
		if(flag!=undefined)
		{
			obj.find(xmlname[lv-1]).each(function(i)
			{
				if($(this).attr('Code')==flag.code&&$(this).attr('Name')==flag.name)//此处获取初始所需的元素
				{
					getchild($(this).eq(0),xmlname,lv+1);
				}
			});
		}
		else
		{
			obj.find(xmlname[lv-1]).each(function(i)
			{
				//need[xmlname[lv-1]+'']+=$(this).attr('Code')==undefined?'':$(this).attr('Code')+'->'+$(this).attr('Name')+'</br>';
				var a=[];
				if($(this).attr('Code')!=undefined)
				{
					a['Code']=$(this).attr('Code');
					a['Name']=$(this).attr('Name');
				}
				need[xmlname[lv-1]+''].push(a);
				if(lv-1<xmlname.length&&i==0)
				{
					getchild($(this),xmlname,lv+1);
				}
			});
			
		}
	}
	getchild(obj,xmlname,lv,flag);
	//console.log(need);
	return need;
}



/*
	获取目录下所有元素
		取出第一个元素
			获取该元素的所有子元素
				取出第一个子元素
					获取该元素的所有子元素




*/

















/*公共ajax函数 要求返回值必须是true false 且json格式,*/
function _ajaxget(str,url,callback,failcall,asy)
{
	asy==undefined?asy=true:'';
	$.ajax({
	url:'action/'+url+'.php',
	method:'POST',
	dataType:'json',
	data:str,
	async:asy,
	success:function(m)
	{
		if(m)
		{
			if(typeof callback=='function')
			{
				callback(m);
			}
		}else
		{
			console.log(str+'_ajaxget操作验证信息出错');
			if(typeof failcall=='function')
			{
				failcall(m);
			}
		}

	}
	,
	error:function()
	{
		console.log(str+'_ajaxget网络或程序出错');
	}
	,
	});

}

function _ajaxupload(str,url,callback,failcall,asy)
{
	asy==undefined?asy=true:'';
	$.ajax({
	url:'action/'+url+'.php',
	method:'POST',
	dataType:'json',
	data:str,
	async:asy,
	cache: false,  
    contentType: false,  
    processData: false,
	success:function(m)
	{
		if(m)
		{
			if(typeof callback=='function')
			{
				callback(m);
			}
		}else
		{
			console.log(str+'_ajaxget操作验证信息出错');
			if(typeof failcall=='function')
			{
				failcall(m);
			}
		}

	}
	,
	error:function()
	{
		console.log(str+'_ajaxget网络或程序出错');
	}
	,
	});

}


/*判断日期昨天今天明天
	
getDateString(格式化日期/时间戳,如果不能用文字表达，则要返回的时间模式（0月日，1年月日，2时分秒，3年月日时分秒，默认0）,时间分隔号，默认'-')

*/
function getDateString(date,mode,split)
{
	var str='';
	var now=new Date();
	if(date.match(/^\d+$/g))
	{
		date=parseInt(date)*1000;
	}
	else
	{
		date=date.replace(/-/g,'/').replace(',',' ');
	}
	var ever=new Date(date);

	var dvalue=Math.floor((now-ever)/(1000 * 60 * 60 * 24));
	/*if(dvalue==0)
	{
		str='今天';
	}
	else*/ if(dvalue==1)
	{
		str='昨天';
	}
	else if(dvalue==2)
	{
		str='前天';
	}
	else if(dvalue==-1)
	{
		str='明天';
	}
	else if(dvalue==-2)
	{
		str='后天';
	}
	else
	{
		if(dvalue==0)
		{
			mode=2;
		}
		mode==undefined?mode=3:'';
		split==undefined?split='-':'';

		if(mode==0)//显示月日
		{
			str=(ever.getMonth()+1)+split+ever.getDate();
		}
		else if(mode==1)//显示年月日
		{
			str=ever.getFullYear()+split+(ever.getMonth()+1)+split+ever.getDate();
		}
		else if(mode==2)//显示时分秒
		{
			str=(ever.getHours()<10?'0'+ever.getHours():ever.getHours())+':'+(ever.getMinutes()<10?'0'+ever.getMinutes():ever.getMinutes())+':'+(ever.getSeconds()<10?'0'+ever.getSeconds():ever.getSeconds());
		}
		else if(mode==3)//显示年月日时分秒
		{
			str=ever.getFullYear()+split+(ever.getMonth()+1)+split+ever.getDate()+' '+(ever.getHours()<10?'0'+ever.getHours():ever.getHours())+':'+(ever.getMinutes()<10?'0'+ever.getMinutes():ever.getMinutes())+':'+(ever.getSeconds()<10?'0'+ever.getSeconds():ever.getSeconds());
		}
	}
	return str;

}




/*
通过年份和月份得出该月有几天
*/
function howmuchdays(year,month)
{
	var days=31;
	switch(parseInt(month))
	{
		case 2:
			days=(((year % 4)==0) && ((year % 100)!=0) || ((year % 400)==0))?29:28;
			break;
		case 4:
		case 6:
		case 9:
		case 11:
			days=30;
			break;
	}
	return days;
}





/*

var k='frd:1;grp:2;frd:9999;dis:90;hoto:2;'
function setk(type,id)
{
	var last=k;
	var ls=type+':'+id;

	//last.indexOf(ls)>=0?last.replace(ls,''):'';

	//last=ls+last;
	
	var larr=last.split(';');
	for(var i=0;i<larr.length;i++)
	{
		if(i>8||larr[i]==ls)
		{
			larr.remove(i);
		}
	}
	
	k=ls+';'+larr.join(';');
}

setk('dis',10);
setk('dis',20);
setk('dis',30);
/*
setk('dis',40);
setk('dis',50);
setk('dis',20);
setk('dis',60);

console.log(k);
*/